package org.example.backend.demos.web.NewsModule.entity;

import jakarta.servlet.annotation.MultipartConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.io.Serializable;

/**
 * 新闻表(News)实体类
 *
 * @author makejava
 * @since 2025-09-08 15:32:51
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class News implements Serializable {
    private static final long serialVersionUID = 937319904568158929L;
/**
     * 主键ID
     */
    private Long id;
/**
     * 新闻标题
     */
    private String title;
/**
     * 新闻内容
     */
    private String content;
/**
     * 发布者ID
     */
    private Long publisherId;
/**
     * 发布时间
     */
    private Date publishTime;
/**
     * 更新时间
     */
    private Date updateTime;


    public News(Builder builder) {
        this.id = builder.id;
        this.title = builder.title;
        this.content = builder.content;
        this.publisherId = builder.publisherId;
        this.publishTime = builder.publishTime;
        this.updateTime = builder.updateTime;
    }

    public static final class Builder {

        private Long id;
        private String title;
        private String content;
        private Long publisherId;
        private Date publishTime;
        private Date updateTime;
        public Builder id(Long id) {
            this.id = id;
            return this;
        }
        public Builder title(String title) {
            this.title = title;
            return this;
        }
        public Builder content(String content) {
            this.content = content;
            return this;
        }
        public Builder publisherId(Long publisherId) {
            this.publisherId = publisherId;
            return this;
        }
        public Builder publishTime(Date publishTime) {
            this.publishTime = publishTime;
            return this;
        }
        public Builder updateTime(Date updateTime) {
            this.updateTime = updateTime;
            return this;
        }
        public News build() {
            return new News(this);
        }


    }

}

